
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title>Title</title>
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css"
        type="text/css"/>
  <!-- 引入自定义css文件 style.css -->
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css"/>

</head>
<style>
  a {
    text-decoration: none;
  }
</style>
<body>
<div class="container-fluid">

  <!--
      时间：2015-12-30
      描述：菜单栏
  -->
  <div class="container-fluid">
    <div class="col-md-4">
      <a href="${pageContext.request.contextPath}/index.do"><img
              src="${pageContext.request.contextPath}/img/header.jpg"/></a>
    </div>
    <div class="col-md-4">
      <img src="${pageContext.request.contextPath}/img/header.png"/>
    </div>
    <div class="col-md-3" style="padding-top:20px;float: right;">
      <ol class="list-inline">
        <c:if test="${empty user}">

          <div class="dropdown" style="display: inline-block;width:100px;">
            <a class=" dropdown-toggle" id="aaadropdownMenu1"
               data-toggle="dropdown">
              登 陆
              <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
              <li><a href="${pageContext.request.contextPath}/user/gotologin.do">登录</a></li>
              <li><a href="${pageContext.request.contextPath}/user/gotoregister.do">注册</a></li>
            </ul>
          </div>
        </c:if>
        <c:if test="${not empty user}">

          <div class="dropdown" style="display: inline-block">
            <a class=" dropdown-toggle" id="aadropdownMenu1"
               data-toggle="dropdown">
                ${user.username}
              <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
              <li><a href="${pageContext.request.contextPath}/user/loginOut.do">注销</a></li>
              </li>
              <c:if test="${sessionScope.user.state == 100}">
                <li><a href="${pageContext.request.contextPath}/admin/gotoAdminLogin.do">管理员界面</a>
                </li>
              </c:if>
            </ul>
          </div>

          <div class="dropdown" style="display: inline-block">
            <a class="btn dropdown-toggle" id="adropdownMenu1"
               data-toggle="dropdown">
              我的足迹
              <span class="caret"></span>
            </a>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
              <li><a href="${pageContext.request.contextPath}/car/showcar.do">购物车</a></li>
              <li><a href="${pageContext.request.contextPath}/order/orderlist.do?pageid=0">我的订单</a>
              </li>
            </ul>
          </div>

        </c:if>
      </ol>
    </div>
  </div>
  <!--
      时间：2015-12-30
      描述：导航条
  -->
  <div class="container-fluid">
    <nav class="navbar navbar-inverse">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                  data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="${pageContext.request.contextPath}/index.do">首页</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav" id="listofNav">
            <%--#########--%>
          </ul>
          <form class="navbar-form navbar-right" role="search"
                action="${pageContext.request.contextPath}/product/fuzzysearch.do">
            <div class="form-group">
              <input type="text" name="fuzzy" class="form-control" placeholder="填入您想查询的商品">
            </div>
            <button type="submit" class="btn btn-default">查找</button>
          </form>

        </div>
        <!-- /.navbar-collapse -->
      </div>
      <!-- /.container-fluid -->
    </nav>
  </div>
</div>
</body>

<script>
  $.get("${pageContext.request.contextPath}/category/getcategory.do", "", function (d) {
    for (var i = 0; i < d.data.length; i++) {
      var cid = d.data[i].cid;
      var cname = d.data[i].cname;

      $("#listofNav").append("<li><a href=\"${pageContext.request.contextPath}/product/list.do?pageid=0&cid="
          + cid + "\">" + cname
          + "</a></li>");
    }
  }, "json")
</script>


</html>
